home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000357_fdc@columbia.edu_Thu Sep 12 10:16:34 EDT 2002.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  74 lines

  1. Article: 13689 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.os.linux.misc,comp.protocols.kermit.misc
  5. Subject: Re: Serial port scripting
  6. Date: 12 Sep 2002 09:51:50 -0400
  7. Organization: Columbia University
  8. Lines: 57
  9. Message-ID: <alq65m$rqh$1@watsol.cc.columbia.edu>
  10. References: <3D7F5E0E.D5370A8C@arcoide.com> <eMKf9.1183$VM7.322810980@newssvr12.     <3D7F9578.86E64588@arcoide.com> <6bb688813ba3e707c91e156a8a0b9004@remailer.privacy.at>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1031838711 1400 128.59.39.139 (12 Sep 2002 13:51:51 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 12 Sep 2002 13:51:51 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.os.linux.misc:562263 comp.protocols.kermit.misc:13689
  16.  
  17. In article <6bb688813ba3e707c91e156a8a0b9004@remailer.privacy.at>,
  18. Anonymous  <nobody@remailer.privacy.at> wrote:
  19. : Gary <gary@arcoide.com>:
  20. : > I don't know that it'll help you but I have a device that
  21. : > has it's own serial port (a Max232) setup to send a byte of 
  22. : > data every X seconds at 96,n,8,1, or alternately respond to 
  23. : > put out the data after the Max232 receives a 55h. 
  24. : > 
  25. : > I need to setup the comm protocols to the above on the PC
  26. : > serial port, send 55h, and then read the byte sent back.
  27. : > 
  28. : > The data should never change after the first "valid" read.
  29. : > 
  30. : > In the PC/DOS world I could write it in assembler, but need
  31. : > Linux and a script.
  32. : This sounds like a job for 'kermit'. Go to the Kermit Web site:
  33. :          http://www.columbia.edu/kermit/
  34. : and download the sources, or find a binary package for your
  35. : distribution.  A 10-line kermit script should be sufficient.
  36. Kermit for Linux is here:
  37.  
  38.   http://www.columbia.edu/kermit/ckermit.html
  39.  
  40. Binaries are here:
  41.  
  42.   http://www.columbia.edu/kermit/ck80binaries.html
  43.  
  44. Here is a script to read one byte from a serial port:
  45.  
  46.   set port /dev/ttyS0    ; or whatever
  47.   if fail stop 1 "Can't open port"
  48.   set speed 9600         ; or whatever
  49.   set carrier-watch off  ; if device does not assert CD
  50.   set flow none          ; if device does not assert CTS
  51.   input -1               ; wait forever for one byte
  52.   if fail stop 1 "INPUT Failed"
  53.   echo INPUT GOT: \fhexify(\v(inchar))
  54.  
  55. To send hex 55, use:
  56.  
  57.   output \x55
  58.  
  59. To place a time limit on the INPUT command, replace "-1" with
  60. a positive number (of seconds to wait).
  61.  
  62. Embellish as desired for looping, error checking, report
  63. writing, statistics gathering, calculation, etc.  See:
  64.  
  65.   http://www.columbia.edu/kermit/ckscripts.html
  66.  
  67. for examples.
  68.  
  69. - Frank
  70.